import Vue from 'vue';
import Router from 'vue-router';
import Resource from 'vue-resource';
import Header from '@/components/header/Header';
import Seller from '@/components/Seller/Seller';
import Goods from '@/components/Goods/Goods';
import Ratings from '@/components/Ratings/Ratings';
import Home from '@/components/Home/Home';
import Mine from '@/components/Mine/index';
import Search from '@/components/Search/index';
import Index from '@/components/Index';
import Address from '@/components/Address/Address';
import Payfor from '@/components/Payfor/Payfor';
import help from '@/components/help/help';
import order from '@/components/order/order';
// 定义路由插件
Vue.use(Router);

// 定义ajax获取数据的插件Resourse
Vue.use(Resource);

// 定义每个路由对应一个组件
let router = new Router({ // 创建 router 实例，然后传 `routes` 配置
  linkActiveClass: 'active',
  routes: [
    {
      path: '/',
      component: Index,
      meta: {
        title: '门店列表'
      }
    }, {
      path: '/Home',
      name: 'Home',
      component: Home,
      children: [
        {
          path: '/Goods',
          name: 'Goods',
          component: Goods
        },
        {
          path: '/Header',
          name: 'Header',
          component: Header
        },
        {
          path: '/Seller',
          name: 'Seller',
          component: Seller
        },
        {
          path: '/Ratings',
          name: 'Ratings',
          component: Ratings
        }
      ]
    }, {
      path: '/Mine',
      name: 'Mine',
      component: Mine
    }, {
      path: '/Search',
      component: Search
    }, {
      path: '/Address',
      component: Address
    },
    {
      path: '/Payfor',
      name: 'Payfor',
      component: Payfor
    },
    {
      path: '/help',
      name: 'help',
      component: help
    },
    {
      path: '/order',
      name: 'order',
      component: order
    }
  ]
});
export default router;
// router.push('Goods');// 相当于应用一进来就显示goods的内容
// router.push方法就是用来动态导航到不同的链接的。它会向history栈添加一个新的记录，点击<router-link :to="...">等同于调用router.push(...)。
